<!--
 * @Author: 秦福凯
 * @LastEditTime: 2024-10-22 15:38:43
 * @Description: 菜单公共组件
-->
<template>
  <el-menu
    class="u-common-menu"
    v-bind="$attrs"
  >
  <template v-for="(item,index) in data" :key="item.id">
    <!-- 如果有子集 -->
     <template v-if="item.children">
      <SubMenu :data="item"></SubMenu>
     </template>

     <!-- 没有子集 -->
     <template v-else>
      <el-menu-item :index="item.id">
        <el-icon><location /></el-icon>
      <template #title>{{ item.label }}</template>
    </el-menu-item>
     </template>
  </template>
 
  </el-menu>
</template>

<script>
export default {
  name:'Menu',
}
</script>
<script setup>
  import SubMenu from './submenu.vue'

  defineProps({
    data:Array
  })

</script>


<style lang='less' scoped>
  .u-common-menu{
    height: 100% !important;
  }
</style>